from redis import StrictRedis


class Config():
    DEBUG = None

    # 设置秘钥
    SECRET_KEY = 'c/gJNuXSsX93je8A+TVKv5BBfrqI2W5E0X36Rj37BrJ54NDpBBuo3dzdnDSGGaL9aNY='

    # 定义redis的连接配置信息
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379

    # 配置状态保持中的session信息存储的位置redis
    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True
    PERMANENT_SESSION_LIFETIME = 86400

    # mysql数据库的配置连接信息
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/info13'
    SQLALCHEMY_TRACK_MODIFICATIONS = False


# 开发模式下的配置
class DevelopmentConfig(Config):
    DEBUG = True


# 生产模式下的配置
class ProductionConfig(Config):
    DEBUG = False

# 定义一个字典，实现配置对象的映射
config_dict = {
    'development': DevelopmentConfig,
    'production': ProductionConfig
}